package com.lxq.test2006.Main02;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int n,a,b;
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        a=sc.nextInt();
        b=sc.nextInt();

        int[] u,v;
        u=new int[n];
        v=new int[n];

        for (int i=0;i<a;i++){
            int tag=sc.nextInt();
            u[tag-1] = sc.nextInt();
        }

        for (int i=0;i<b;i++){
            int tag=sc.nextInt();
            v[tag-1] = sc.nextInt();
        }

        int sum = 0;
        for (int i=0;i<n;i++){
            sum = sum+u[i]*v[i];
        }

        System.out.println(sum);
    }
}
